package testcases.OpportunitiesBaseDataView.MainView;
import resources.testcases.OpportunitiesBaseDataView.MainView.UI009_Opportunities_Base_Data_View_Main_View_ITS_BrandHelper;
import tasks.Loading;
import tasks.OpportunitiesBaseData.Filters.Applier;
import tasks.OpportunitiesBaseData.MainView.ITSVerifier;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.ControlsMapping;
import core.Preconditions;
import core.enums.Reports;
/**
 * Description   : Functional Test Script
 * @author angel.tsvetkov
 */
public class UI009_Opportunities_Base_Data_View_Main_View_ITS_Brand extends UI009_Opportunities_Base_Data_View_Main_View_ITS_BrandHelper
{
	private boolean stepResult = false;
	private ITSVerifier verifier = new ITSVerifier();
	private Applier filterApplier = new Applier();

	private boolean testCasePreconditions() {
		boolean preconditionResult = false;

		preconditionResult = Preconditions.globalPreconditionCognos(Reports.OpportunitiesBaseDataView);

		return preconditionResult;
	}

    public void executeTest()
    {
        beginTestCase("UI009",
                      "Verify that the fields in the Front End - Opportunities Base Data View - Main View - ITS Brand - are populated with the respective data from Data Base",
                      "",
                      "Angel Tsvetkov",
                      "",
                      "");
        
        if (testCasePreconditions())
        {     
        	TimeWait(3);
        	
        	stepResult = ControlsMapping.FilterCommonElements.showAll_link.clickLink();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.showAll_link.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	stepResult = filterApplier.applyProductFilter("ITS", null, null, null, null, null, null, null, null, null, null, null);
        	setStepResult(stepResult, "Change Brand to ITS in " + ControlsMapping.ProductFilter.BrandOfferingType_listbox.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	stepResult = verifier.verify();
        	setStepResult(stepResult, "Verify front end and DB content.");
        }
    }
    
    public void testMain(Object[] args)
    {
    	setUp(args);
        executeTest();
        reportTestCaseResult("UI009 - Opportunities Base Data View - Main View ITS", Configurations.PROJECT_NAME);
    }
}

